<!DOCTYPE html>
<html>
	<head>

		<title>主营业务</title>
		<meta name="keywords" content="" />
		<meta name="description" content="" />

		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		
		<link rel="stylesheet" type="text/css" href="style/style.css" />
		<script type="text/javascript" src="js/jquery-1.8.1.min.js"></script>
		<script src="js/angular.min.1.4.6.js"></script> 
		<script type="text/javascript" src="js/index.js"></script>

		<script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>
		<script type="text/javascript" src="layer/layer.js"></script>
		
	</head>

	<body  ng-app="indexApp"  ng-controller="box">
		<div class="conter ma">

			<div class="header" ng-include="'header.html'" ></div>
			

			<div class="nybanner"><img src="images/nybanner.jpg" width="997" height="198" /></div>
			<div class="side">
				<div class="stitle">
					主营业务<span> </span></div>
				<div class="conts clicksub">
					<dl>

						<dt class='on'><a href="mainBusiness.htm" >检测服务</a></dt>

						<dt class='on'><a href="auth.htm" >产品认证</a></dt>

						<dt class='on'><a href="train.htm" >培训项目</a></dt>

					</dl>
				</div>
				

				<div class="side_c">
					<p>
						<a href="mainBusiness.htm"><img src="images/sc1.jpg" width="226" height="73" /></a>
					</p>
					<p>
						<a href="auth.htm"><img src="images/sc2.jpg" width="226" height="74" /></a>
					</p>
					<p>
						<a href="train.htm"><img src="images/sc3.jpg" width="226" height="78" /></a>
					</p>
				</div>
			</div>
			<div class="mian">
				<div class="mtitle">
					{{typeName}}<span>您的当前位置：<a href="home.htm" >主页</a> > <a href="#" >{{typeName}}</a> > 
                </span>
				</div>
				<div class="miancont" >
					<div class="detail">
			        <div class="yscont">
			          <div class="tit">{{title}}</div>
			          <div class="related">
						<p>最近更新时间：{{updatedAt}}    <a download="{{file}}" href="{{file}}" ng-if="isfile">    下载:{{fileName}}</a></p>
			          </div>
			          <div class="text" style="white-space: pre-line;">
			           <p ng-bind-html="content | to_trusted"></p>
			          </div>
			          
			          
			        </div>
			      </div>
				</div>
			</div>
			<div class="clear">
			</div>

			<div class="footer"ng-include="'footer.html'" ></div>

		</div>
		<script type="text/javascript">
		var app = angular.module('indexApp', []);
		app.controller('indexContr', function($scope, $http) {
			$(".menu ul li.dq").each(function() {
				$(this).hover(function() {

					$(this).find(".submenu").stop(false, true).slideDown();
				}, function() {

					$(this).find(".submenu").stop(false, true).slideUp();

				});
			});
			function menuon(id) {
				$(".menu ul li.dq a").each(function() {
					$(this).removeClass("on");
				});
				$(".menu ul li.dq").eq(id - 1).children("a").addClass("on");
			}
			$(".menu ul li .submenu .submenubg a:last-child").css("border-bottom", "none");
			menuon(4);
			// 简单的 GET 请求，可以改为 POST
			
		
		
		
		});
		app.controller('box', function($scope,$http) {
			$scope.isfile = false;
			function GetQueryString(name){
			     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
			     var r = window.location.search.substr(1).match(reg);
			     if(r!=null)return  decodeURI(r[2]); return null;
			}
			console.log(GetQueryString('id'));
			var infoId = GetQueryString('id');
			// 简单的 GET 请求，可以改为 POST
			$http({
			    method: 'POST',
			    url: 'information/getInfo?id='+infoId
			}).then(function successCallback(response) {
			        // 请求成功执行代码
			        console.log(response);
			        var res = response.data;
			        if(res.status == 10001){
			        	$scope.content = res.data.content;
			        	$scope.title = res.data.title;
			        	$scope.updatedAt =  fmtDate(res.data.updatedAt);
			        	$scope.typeName = res.data.typeName;
			        	if(res.data.file == ""){
			        		$scope.file = "";
			        		$scope.isfile = false;
			        	}else{
			        		$scope.file = res.data.file;
			        		$scope.fileName = res.data.fileName;
			        		$scope.isfile = true;
			        	}
			        }
				
			    }, function errorCallback(response) {
			        // 请求失败执行代码
			});
			function fmtDate(obj){
				var date = new Date(obj);
			    var y = date.getFullYear();
			    var m = date.getMonth() + 1;
			    m = m < 10 ? ('0' + m) : m;
			    var d = date.getDate();
			    d = d < 10 ? ('0' + d) : d;
			    var h = date.getHours();
			    h = h < 10 ? ('0' + h) : h;
			    var minute = date.getMinutes();
			    var second = date.getSeconds();
			    minute = minute < 10 ? ('0' + minute) : minute;
			    second = second < 10 ? ('0' + second) : second;
			    
			      return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
			    
			}
		});
		app.filter('to_trusted', ['$sce', function ($sce) {
		　　  return function (text) {
		    　　  return $sce.trustAsHtml(text);
		　　};
		}]);
		</script>

	</body>

</html>